<?php include "include/function_library.php"; ?>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>

<?php include "html/header.html"; ?>

</head>
<body class="tcuk home">

	<div id="wp">
	
		<?php  include "html/menu.html"; ?>
		
		<!-- CONTENT STARTS-->
		<div id="ct">	
			
			<?php 
				if(get("edited") == "1") echo "<div class='alert success'>Transportation Edited Successfully!</div>";
				if(get("purchased") == "1") echo "<div class='alert success'>Transportation Ticket Purchased Successfully!</div>";
			
				$id = get("id");
				$query = "SELECT * FROM transportation WHERE id=$id";
				$result = sql_query($query);
				
				$tuple = mysql_fetch_assoc($result);
				?>
				
				<table style="width:80%;height:100%;">
					<tr>
						<td><img alt="" src="resource/<?php if($tuple["type"] == "Bus") echo "transportation_bus.jpg";
															elseif($tuple["type"] == "Ship") echo "transportation_ship.jpg";
															elseif($tuple["type"] == "Train") echo "transportation_train.jpg";
															else echo "transportation_plane.jpg";
														?>" width="500px"></td>			
						<td>
							<h2><?php echo $tuple["source"]; ?>-<?php echo $tuple["destination"]; ?></h2><br />
							<ul>
								<li><b>Type :</b> <?php echo $tuple["type"]; ?></li>
								<li><b>Date :</b> <?php echo $tuple["date"]; ?></li>
								<li><b>Price :</b> <?php echo $tuple["price"]; ?></li>
								<li><b>Capacity :</b> <?php echo $tuple["capacity"]; ?></li>
							</ul>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<h3>Details</h3><br/>
							<p><?php echo $tuple["description"]; ?></p>
						</td>
					</tr>
					
					<tr>
						<td colspan="3" style="text-align:right">
							<?php
							if(session("is_customer") == "0") {
								?>
								<a href="edit_transportation.php?id=<?php echo $tuple["id"]; ?>"><button>Edit</button></a>
								<a href="delete_transportation.php?id=<?php echo $tuple["id"]; ?>"><button>Delete</button></a>
								<?php
							} else {
								?>
								<a href="purchase_transportation.php?id=<?php echo $tuple["id"]; ?>"><button>Purchase</button></a>
								<?php
							}
							?>
						</td>
					</tr>
					
				</table>
				
		</div> 	
		<!-- CONTENT ENDS-->		
		
		<?php include "html/footer.html"; ?>
		
	</div>
	
</body>
</html>